package com.xiaoshuidi.cloud.module.member.enums;

import cn.hutool.core.lang.Assert;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum MemberUserStaticsticsEnum {
    TOTAL("1","共计用户"),
    AUTHENTICATED("2","已实名认证"),
    UNAUTHENTICATED("3","未实名认证"),
    TODAYNEWUSER("4"," 今日新用户"),
    WEEKNEWUSER("5"," 本周新增用户");
    private String code;
    private String name;
    //
    public static String getNameByCode(String code) {
        MemberUserStaticsticsEnum memberUserStaticsticsEnum = Arrays.stream(MemberUserStaticsticsEnum.values()).filter(p -> p.code.equals(code)).findFirst().orElse(null);
        Assert.isTrue(memberUserStaticsticsEnum != null, "MemberUserStaticsticsEnum:{}不存在", code);
        return memberUserStaticsticsEnum.getName();
    }
}
